package com.gopay.common.domain.aggregatepayment;

import com.gopay.common.cipher.utils.SensitiveInfoUtils;
import com.gopay.common.domain.BaseEntity;

import javax.persistence.*;
import java.util.Date;

/**
 * @author Chenyu Li
 * @description 聚合支付合同表
 * @date 2017/12/29
 * Copyright (c) 2017. www.gopay.com.cn Inc.All rights reserved.
 */
@Entity
@Table(name = "AP_CONTRACT_INFO")
public class ApContractInfo extends BaseEntity {
    private Long contractId;
    private String custId;
    private String cttId;
    private String custName;
    private String custAbbreviation;
    private String email;
    private String mctNo;
    private String signName;
    private String code;
    private String signDate;
    private String signMan;
    private String sdate;
    private String edate;
    private String contact;
    private String contactTel;
    private String autoSign;
    private String pic1;
    private String pic2;
    private String pmtId;
    private String pmfId;
    private String fee;
    private String pmfLimit;
    private String type;
    private String categoryId;
    private String categoryIdSelect;
    private String servicePhone;
    private Integer mts;
    private String status;
    private Date createdTs;
    private Date lastUpdTs;
    private int version;
    private String lastUpdOperId;

    @Id
    @SequenceGenerator(name = "AP_CONTRACT_INFO_SEQ_GENERATOR", sequenceName = "AP_CONTRACT_INFO_SEQ", allocationSize = 1)
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "AP_CONTRACT_INFO_SEQ_GENERATOR")
    @Column(name = "CONTRACT_ID", nullable = false, length = 10)
    public Long getContractId() {
        return contractId;
    }

    public void setContractId(Long contractId) {
        this.contractId = contractId;
    }

    @Basic
    @Column(name = "CUST_ID", nullable = true, length = 10)
    public String getCustId() {
        return custId;
    }

    public void setCustId(String custId) {
        this.custId = custId;
    }

    @Basic
    @Column(name = "LAST_UPD_OPER_ID", nullable = true, length = 10)
    public String getLastUpdOperId() {
        return lastUpdOperId;
    }

    public void setLastUpdOperId(String lastUpdOperId) {
        this.lastUpdOperId = lastUpdOperId;
    }

    @Basic
    @Column(name = "CTT_ID", nullable = true, length = 20)
    public String getCttId() {
        return cttId;
    }

    public void setCttId(String cttId) {
        this.cttId = cttId;
    }

    @Basic
    @Column(name = "CUST_NAME", nullable = true, length = 100)
    public String getCustName() {
        return custName;
    }

    public void setCustName(String custName) {
        this.custName = custName;
    }

    @Basic
    @Column(name = "CUST_ABBREVIATION", nullable = true, length = 100)
    public String getCustAbbreviation() {
        return custAbbreviation;
    }

    public void setCustAbbreviation(String custAbbreviation) {
        this.custAbbreviation = custAbbreviation;
    }

    @Basic
    @Column(name = "EMAIL", nullable = true, length = 20)
    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    @Basic
    @Column(name = "MCT_NO", nullable = true, length = 20)
    public String getMctNo() {
        return mctNo;
    }

    public void setMctNo(String mctNo) {
        this.mctNo = mctNo;
    }

    @Basic
    @Column(name = "SIGN_NAME", nullable = true, length = 50)
    public String getSignName() {
        return signName;
    }

    public void setSignName(String signName) {
        this.signName = signName;
    }

    @Basic
    @Column(name = "CODE", nullable = true, length = 50)
    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    @Basic
    @Column(name = "SIGN_DATE", nullable = true)
    public String getSignDate() {
        return signDate;
    }

    public void setSignDate(String signDate) {
        this.signDate = signDate;
    }

    @Basic
    @Column(name = "SIGN_MAN", nullable = true, length = 25)
    public String getSignMan() {
        return signMan;
    }

    public void setSignMan(String signMan) {
        this.signMan = signMan;
    }

    @Basic
    @Column(name = "SDATE", nullable = true)
    public String getSdate() {
        return sdate;
    }

    public void setSdate(String sdate) {
        this.sdate = sdate;
    }

    @Basic
    @Column(name = "EDATE", nullable = true)
    public String getEdate() {
        return edate;
    }

    public void setEdate(String edate) {
        this.edate = edate;
    }

    @Basic
    @Column(name = "CONTACT", nullable = true, length = 25)
    public String getContact() {
        return contact;
    }

    public void setContact(String contact) {
        this.contact = contact;
    }

    @Basic
    @Column(name = "CONTACT_TEL", nullable = true, length = 25)
    public String getContactTel() {
        this.contactTel = SensitiveInfoUtils.autoReencrypt(this.contactTel);
        return SensitiveInfoUtils.smartDecryptWithCheck(this.contactTel);
    }

    public void setContactTel(String contactTel) {
        this.contactTel = SensitiveInfoUtils.smartEncryptWithCheck(contactTel);
    }

    @Basic
    @Column(name = "AUTO_SIGN", nullable = true, length = 1)
    public String getAutoSign() {
        return autoSign;
    }

    public void setAutoSign(String autoSign) {
        this.autoSign = autoSign;
    }

    @Basic
    @Column(name = "PIC1", nullable = true, length = 100)
    public String getPic1() {
        return pic1;
    }

    public void setPic1(String pic1) {
        this.pic1 = pic1;
    }

    @Basic
    @Column(name = "PIC2", nullable = true, length = 100)
    public String getPic2() {
        return pic2;
    }

    public void setPic2(String pic2) {
        this.pic2 = pic2;
    }

    @Basic
    @Column(name = "PMT_ID", nullable = true, length = 9)
    public String getPmtId() {
        return pmtId;
    }

    public void setPmtId(String pmtId) {
        this.pmtId = pmtId;
    }

    @Basic
    @Column(name = "PMF_ID", nullable = true, length = 9)
    public String getPmfId() {
        return pmfId;
    }

    public void setPmfId(String pmfId) {
        this.pmfId = pmfId;
    }

    @Basic
    @Column(name = "FEE", nullable = true, length = 4)
    public String getFee() {
        return fee;
    }

    public void setFee(String fee) {
        this.fee = fee;
    }

    @Basic
    @Column(name = "PMF_LIMIT", nullable = true, length = 9)
    public String getPmfLimit() {
        return pmfLimit;
    }

    public void setPmfLimit(String pmfLimit) {
        this.pmfLimit = pmfLimit;
    }

    @Basic
    @Column(name = "TYPE", nullable = true, length = 1)
    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    @Basic
    @Column(name = "CATEGORY_ID", nullable = true, length = 20)
    public String getCategoryId() {
        return categoryId;
    }

    public void setCategoryId(String categoryId) {
        this.categoryId = categoryId;
    }

    @Basic
    @Column(name = "CATEGORY_ID_SELECT", nullable = true, length = 100)
    public String getCategoryIdSelect() {
        return categoryIdSelect;
    }

    public void setCategoryIdSelect(String categoryIdSelect) {
        this.categoryIdSelect = categoryIdSelect;
    }

    @Basic
    @Column(name = "SERVICE_PHONE", nullable = true, length = 20)
    public String getServicePhone() {
        this.servicePhone = SensitiveInfoUtils.autoReencrypt(this.servicePhone);
        return SensitiveInfoUtils.smartDecryptWithCheck(this.servicePhone);
    }

    public void setServicePhone(String servicePhone) {
        this.servicePhone = SensitiveInfoUtils.smartEncryptWithCheck(servicePhone);
    }

    @Basic
    @Column(name = "MTS", nullable = true, precision = 0)
    public Integer getMts() {
        return mts;
    }

    public void setMts(Integer mts) {
        this.mts = mts;
    }

    @Basic
    @Column(name = "STATUS", nullable = true, length = 1)
    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    @Basic
    @Column(name = "CREATED_TS", nullable = false)
    public Date getCreatedTs() {
        return createdTs;
    }

    public void setCreatedTs(Date createdTs) {
        this.createdTs = createdTs;
    }

    @Basic
    @Column(name = "LAST_UPD_TS", nullable = false)
    public Date getLastUpdTs() {
        return lastUpdTs;
    }

    public void setLastUpdTs(Date lastUpdTs) {
        this.lastUpdTs = lastUpdTs;
    }

    @Basic
    @Column(name = "VERSION", nullable = false, precision = 0)
    public int getVersion() {
        return version;
    }

    public void setVersion(int version) {
        this.version = version;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        ApContractInfo that = (ApContractInfo) o;

        if (version != that.version) {
            return false;
        }
        if (contractId != null ? !contractId.equals(that.contractId) : that.contractId != null) {
            return false;
        }
        if (custId != null ? !custId.equals(that.custId) : that.custId != null) {
            return false;
        }
        if (lastUpdOperId != null ? !lastUpdOperId.equals(that.lastUpdOperId) : that.lastUpdOperId != null) {
            return false;
        }
        if (cttId != null ? !cttId.equals(that.cttId) : that.cttId != null) {
            return false;
        }
        if (custName != null ? !custName.equals(that.custName) : that.custName != null) {
            return false;
        }
        if (custAbbreviation != null ? !custAbbreviation.equals(that.custAbbreviation) : that.custAbbreviation != null) {
            return false;
        }
        if (email != null ? !email.equals(that.email) : that.email != null) {
            return false;
        }
        if (mctNo != null ? !mctNo.equals(that.mctNo) : that.mctNo != null) {
            return false;
        }
        if (signName != null ? !signName.equals(that.signName) : that.signName != null) {
            return false;
        }
        if (code != null ? !code.equals(that.code) : that.code != null) {
            return false;
        }
        if (signDate != null ? !signDate.equals(that.signDate) : that.signDate != null) {
            return false;
        }
        if (signMan != null ? !signMan.equals(that.signMan) : that.signMan != null) {
            return false;
        }
        if (sdate != null ? !sdate.equals(that.sdate) : that.sdate != null) {
            return false;
        }
        if (edate != null ? !edate.equals(that.edate) : that.edate != null) {
            return false;
        }
        if (contact != null ? !contact.equals(that.contact) : that.contact != null) {
            return false;
        }
        if (contactTel != null ? !contactTel.equals(that.contactTel) : that.contactTel != null) {
            return false;
        }
        if (autoSign != null ? !autoSign.equals(that.autoSign) : that.autoSign != null) {
            return false;
        }
        if (pic1 != null ? !pic1.equals(that.pic1) : that.pic1 != null) {
            return false;
        }
        if (pic2 != null ? !pic2.equals(that.pic2) : that.pic2 != null) {
            return false;
        }
        if (pmtId != null ? !pmtId.equals(that.pmtId) : that.pmtId != null) {
            return false;
        }
        if (pmfId != null ? !pmfId.equals(that.pmfId) : that.pmfId != null) {
            return false;
        }
        if (fee != null ? !fee.equals(that.fee) : that.fee != null) {
            return false;
        }
        if (pmfLimit != null ? !pmfLimit.equals(that.pmfLimit) : that.pmfLimit != null) {
            return false;
        }
        if (type != null ? !type.equals(that.type) : that.type != null) {
            return false;
        }
        if (categoryId != null ? !categoryId.equals(that.categoryId) : that.categoryId != null) {
            return false;
        }
        if (categoryIdSelect != null ? !categoryIdSelect.equals(that.categoryIdSelect) : that.categoryIdSelect != null) {
            return false;
        }
        if (servicePhone != null ? !servicePhone.equals(that.servicePhone) : that.servicePhone != null) {
            return false;
        }
        if (mts != null ? !mts.equals(that.mts) : that.mts != null) {
            return false;
        }
        if (status != null ? !status.equals(that.status) : that.status != null) {
            return false;
        }
        if (createdTs != null ? !createdTs.equals(that.createdTs) : that.createdTs != null) {
            return false;
        }
        if (lastUpdTs != null ? !lastUpdTs.equals(that.lastUpdTs) : that.lastUpdTs != null) {
            return false;
        }

        return true;
    }

    @Override
    public int hashCode() {
        int result = contractId != null ? contractId.hashCode() : 0;
        result = 31 * result + (custId != null ? custId.hashCode() : 0);
        result = 31 * result + (cttId != null ? cttId.hashCode() : 0);
        result = 31 * result + (custName != null ? custName.hashCode() : 0);
        result = 31 * result + (lastUpdOperId != null ? lastUpdOperId.hashCode() : 0);
        result = 31 * result + (custAbbreviation != null ? custAbbreviation.hashCode() : 0);
        result = 31 * result + (email != null ? email.hashCode() : 0);
        result = 31 * result + (mctNo != null ? mctNo.hashCode() : 0);
        result = 31 * result + (signName != null ? signName.hashCode() : 0);
        result = 31 * result + (code != null ? code.hashCode() : 0);
        result = 31 * result + (signDate != null ? signDate.hashCode() : 0);
        result = 31 * result + (signMan != null ? signMan.hashCode() : 0);
        result = 31 * result + (sdate != null ? sdate.hashCode() : 0);
        result = 31 * result + (edate != null ? edate.hashCode() : 0);
        result = 31 * result + (contact != null ? contact.hashCode() : 0);
        result = 31 * result + (contactTel != null ? contactTel.hashCode() : 0);
        result = 31 * result + (autoSign != null ? autoSign.hashCode() : 0);
        result = 31 * result + (pic1 != null ? pic1.hashCode() : 0);
        result = 31 * result + (pic2 != null ? pic2.hashCode() : 0);
        result = 31 * result + (pmtId != null ? pmtId.hashCode() : 0);
        result = 31 * result + (pmfId != null ? pmfId.hashCode() : 0);
        result = 31 * result + (fee != null ? fee.hashCode() : 0);
        result = 31 * result + (pmfLimit != null ? pmfLimit.hashCode() : 0);
        result = 31 * result + (type != null ? type.hashCode() : 0);
        result = 31 * result + (categoryId != null ? categoryId.hashCode() : 0);
        result = 31 * result + (categoryIdSelect != null ? categoryIdSelect.hashCode() : 0);
        result = 31 * result + (servicePhone != null ? servicePhone.hashCode() : 0);
        result = 31 * result + (mts != null ? mts.hashCode() : 0);
        result = 31 * result + (status != null ? status.hashCode() : 0);
        result = 31 * result + (createdTs != null ? createdTs.hashCode() : 0);
        result = 31 * result + (lastUpdTs != null ? lastUpdTs.hashCode() : 0);
        result = 31 * result + version;
        return result;
    }
}
